<!DOCTYPE html>
<!--[if IE 8]>			<html class="ie ie8"> <![endif]-->
<!--[if IE 9]>			<html class="ie ie9"> <![endif]-->
<!--[if gt IE 9]><!-->	<html> <!--<![endif]-->
<head>
	<meta charset="utf-8">
	<title>订单详情 {$site_name} </title>
	<meta name="keywords" content="{$menu.menu_seo_key|default=$site_seo_keywords}" />
	<meta name="description" content="{$menu.menu_seo_des|default=$site_seo_description}">
	{include file="public:head_user" /}
</head>
<body class="body-white">
<div class="wrap">
	{include file="public:nav" /}
	<div id="main-cmf">
		<div class="breadcrumb-wrapper">
			<div class="container">
				<div class="row">
					<div class="col-lg-6 col-md-6 col-xs-12 col-sm-6">
						<h2 class="title">{:lang('personal center')}</h2>
					</div>
					<div class="col-lg-6 col-md-6 col-xs-12 col-sm-6">
						<div class="breadcrumbs pull-right">
							<ul>
								<li>{:lang('current location')}:</li>
								<li><a href="__ROOT__/">{:lang('home')}</a></li>
								<li><a href="{:url('home/Center/index')}">{:lang('personal center')}</a></li>
								<li>{:lang('my orderlist')}</li>
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="content">
			<div class="container">
				<div class="row">
					<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
						{include file="public:usernav"/}
					</div>
					<div class="col-lg-9 col-md-9 col-sm-9 col-xs-12">
							<div class="row">
								<div class="panel panel-default">
                                  <div class="panel-heading" style="padding:10px 15px; border-radius:0; background:#f5f5f5">订单号：{$order["sn"]}
                                  
                                  <div style="float:right"> 
                                  {if condition="$order['state_trade'] eq 1 and $order['state_pay'] eq 1"}
                                  
                                      <select class="form-control" style=" margin:0; padding:0;height:25px" id="pay_type" onChange="update_this(this);" name="pay_type">
                                         <option value="alipay" {if condition="$order['pay_type'] eq 'alipay'"} selected {/if}>支付宝</option>
                                         <option value="wxpayqrcode" {if condition="$order['pay_type'] eq 'wxpayqrcode'"} selected {/if}>微信扫码</option>
                                         {if condition="$order['order_type'] lt 1"}
                                         <option value="money" {if condition="$order['pay_type'] eq 'money'"} selected {/if}>余额</option>
                                         {/if}
                                      </select>
                                      
                                      <script language="javascript">
                                         function update_this(obj){
										     var _v = $(obj).val();
											  $.post('{:url("home/center/updateOrder")}',{id:'{$order.id}',field:'pay_type',val:_v},function(res){
												     if(res.code == 0){
													    layer.msg(res.msg,{icon:7});
													 }
											 },'json');
											 
 										 }
                                      </script>
                                 
                                  {else/}
                                  &nbsp;&nbsp;&nbsp;支付方式：{$order['pay_type_name']}
                                  
                                  {/if} 
                                  </div>
                                  </div>
                                  <div class="panel-body">
                                    {if condition="$order['order_type'] neq 2"}
                                        <p>{$order.subject}</p>
                                    {else/}
                                    <div style="position:relative">收货人：{$order["address_cache"]["man"]} &nbsp;&nbsp;&nbsp;电话：{$order["address_cache"]["mobile"]}</div>
                                    <p><i class="fa fa-map-marker"></i> 收货地址：{$order["address_cache"]["address"]}</p>
                                    
                                           
                                    {/if}
                                  </div>
                                  
                                  {if condition="$order['order_type'] neq 2"}
                                   
                                    <table class="table" style="background-color:#f8f8f8">
                                    <tbody>
                                        <tr>
                                            <td align="right" id="total" style="background-color:#fff">总计：<span>￥{$order["total_fee"]}</span></td>
                                        </tr>
                                        <tr>
                                            <td align="right" colspan="2" style="background-color:#fff">
                                             
                                     		 {if condition="$order['state_trade'] eq 1 or $order['state_trade'] eq 2"}
                                             		{if condition="$order['state_pay'] lt 2"}
                                                            <button type="button" class="btn btn-danger" onClick="gopay({$order.id});"> 支付订单 </button> &nbsp;
                                                     {/if}
                                             		<a href="{:url("home/order/del",["id"=>$order["id"]])}" class="btn btn-default" onClick="return confirm('确认要取消此订单吗？');"> 取消订单 </a>
                                             {/if} 
                                   			</td>
                                        </tr>    
                                    </tbody>
                                    </table>        	
                                  {else/}    
                                  <table class="table">
                                    <thead>
                                    <tr>
                                        <th>商品</th>
                                        <th width="20%">属性</th>
                                        <th width="10%">单价</th>
                                        <th width="15%">数量</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {foreach name="order['goods']" item="g"}
                                    <tr id="goods_item_{$g["id"]}">
                                        <td>
                                        {notempty name="g['thumb']"}
                                        <a class="good_img" href="{:url("home/shop/show",["id"=>$g["id"]])}" target="_blank"><img src="{$g["thumb"]}" style="max-width:150px"></a>
                                        {/notempty}
                                        <a class="good_title" href="{:url("home/shop/show",["id"=>$g["id"]])}" target="_blank">{$g["goods_title"]}</a>
                                        <input type="hidden" name="id[]" value="{$g["id"]}">
                                        </td>
                                        <td>分类：{$g["cate_name"]}</td>
                                        <td>{$g["price"]}</td>
                                        <td>{$order["number"]}</td>
                                    </tr>
                                    {/foreach}
                                    </tbody>
                                  </table>
                                  <table class="table" style="background-color:#f8f8f8">
                                    <tbody>
                                        <tr>
                                            <td rowspan="2">备注：</td>
                                            <td width="40%" style="position:relative">优惠：无 <span class="more"></span></td>
                                        </tr>
                                        <tr>
                                            <td style="position:relative">快递：普通快递 <span class="more"></span></td>
                                        </tr>
                                        <tr>
                                            <td align="right" colspan="2" id="total" style="background-color:#fff">总计：<span>￥{$order["total_fee"]}</span></td>
                                        </tr>
                                        <tr>
                                            <td align="right" colspan="2" style="background-color:#fff">
                                            
                                            {if condition="$order['state_trade'] eq 1 or $order['state_trade'] eq 2"}
                                                {if condition="$order['state_pay'] lt 2"}
                                                <button type="button" class="btn btn-danger" onClick="gopay({$order.id});"> 支付订单 </button> &nbsp;
                                                {/if}
                                                <a href="{:url("home/order/del",["id"=>$order["id"]])}" class="btn btn-default" onClick="return confirm('确认要取消此订单吗？');"> 取消订单 </a>
                                            {/if} 
                                            {if condition="$order['state_pay'] eq 2"}
                                                {if condition="$order['state_trade'] eq 3"}
                                                     <button type="button" class="btn btn-success" onClick="alert('待接入');"> 确认收货 </button> &nbsp;
                                                {/if}
                                                {if condition="$order['state_trade'] eq 4"}
                                                     <button type="button" class="btn btn-info" onClick="alert('待接入');"> 评论 </button> &nbsp;
                                                {/if}
                                            
                                                {switch name="order.state_trade"}
                                                   {case value="2"}
                                                      已付款 [商家备货中]  
                                                   {/case}
                                                   {case value="3"}
                                                      [已发货] 快递编号:{$order.express_code}  
                                                   {/case}
                                                   {case value="9"}
                                                      [交易结束]
                                                   {/case}
                                                {/switch}
                                            
                                            {/if}
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                
                                {/if}
                                
                                </div>
							</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	{include file="public:footer"/}
</div>
<script>
    function gopay(id){
       var url = "{:url('home/payment/payorder',['id'=>'_ID_'])}";
	   url = url.replace('_ID_',id);
	   location.href = url;
	}
	
</script>
{include file="public:scripts"/}
</body>
</html>